const hsqjCommonJson = {
  '011_30_4': {
    gener: {
      subjectCode: '660208',
      subjectName: '业务招待费',
    },
    small: {
      subjectCode: '560208',
      subjectName: '业务招待费',
    },
  },
  '011_32_4': {
    gener: {
      subjectCode: '660107',
      subjectName: '广告费和业务宣传费',
    },
    small: {
      subjectCode: '560107',
      subjectName: '广告费和业务宣传费',
    },
  },
  '011_36_4': {
    gener: {
      subjectCode: '660306',
      subjectName: '利息支出',
    },
    small: {
      subjectCode: '560306',
      subjectName: '利息支出',
    },
  },
  '011_41_4': {
    gener: {
      subjectCode: '671107',
      subjectName: '税收滞纳金、罚金、罚款',
      formula(amt, result, saasData) {
        const value =
          (
            saasData.find(item =>
              item.subjectCode === '671108' &&
                item.subjectName === '被没收财物的损失') || {}
          ).amt || 0;
        return `${Number.parseFloat(amt) + Number.parseFloat(value)}`;
      },
    },
    small: {
      subjectCode: '571107',
      subjectName: '税收滞纳金、罚金、罚款',
      formula(amt, result, saasData) {
        const value =
          (
            saasData.find(item =>
              item.subjectCode === '571108' &&
                item.subjectName === '被没收财物的损失') || {}
          ).amt || 0;
        return `${Number.parseFloat(amt) + Number.parseFloat(value)}`;
      },
    },
  },
  '011_43_4': {
    gener: {
      subjectCode: '671110',
      subjectName: '赞助支出',
    },
    small: {
      subjectCode: '571110',
      subjectName: '赞助支出',
    },
  },
  '011_142_4': {
    gener: {
      subjectCode: '66020701',
      subjectName: '工资',
    },
    small: {
      subjectCode: '56020701',
      subjectName: '工资',
    },
  },
  '011_144_4': {
    gener: {
      subjectCode: '66020702',
      subjectName: '福利费',
    },
    small: {
      subjectCode: '56020702',
      subjectName: '福利费',
    },
  },
  '011_149_4': {
    gener: {
      subjectCode: '66020703',
      subjectName: '社保费',
    },
    small: {
      subjectCode: '56020703',
      subjectName: '社保费',
    },
  },
};
// 小微企业 企业经营数据采集表（合成表）
const hsqjSmallInputJson = {
  '004_3_2': {
    gener: {
      subjectCode: '6001',
      subjectName: '主营业务收入',
      formula(amt, result, saasData) {
        const value = saasData
          .filter(item =>
            ['6051', '6011', '6021', '6031', '6041'].includes(item.subjectCode))
          .reduce((result, item) => {
            result += Number.parseFloat(item.amt || 0);
            return result;
          }, 0);
        return `${Number.parseFloat(amt) + Number.parseFloat(value)}`;
      },
    },
    small: {
      subjectCode: '5001',
      subjectName: '主营业务收入',
      formula(amt, result, saasData) {
        const value = saasData
          .filter(item => ['5051'].includes(item.subjectCode))
          .reduce((result, item) => {
            result += Number.parseFloat(item.amt || 0);
            return result;
          }, 0);
        return `${Number.parseFloat(amt) + Number.parseFloat(value)}`;
      },
    },
  },
  '004_4_2': {
    gener: {
      subjectCode: '6401',
      subjectName: '主营业务成本',
      formula(amt, result, saasData) {
        const value = saasData
          .filter(item => ['6402', '6411', '6421'].includes(item.subjectCode))
          .reduce((result, item) => {
            result += Number.parseFloat(item.amt || 0);
            return result;
          }, 0);
        return `${Number.parseFloat(amt) + Number.parseFloat(value)}`;
      },
    },
    small: {
      subjectCode: '5401',
      subjectName: '主营业务成本',
      formula(amt, result, saasData) {
        const value = saasData
          .filter(item => ['5402'].includes(item.subjectCode))
          .reduce((result, item) => {
            result += Number.parseFloat(item.amt || 0);
            return result;
          }, 0);
        return `${Number.parseFloat(amt) + Number.parseFloat(value)}`;
      },
    },
  },
  '004_5_2': {
    gener: {
      subjectCode: '6403',
      subjectName: '税金及附加',
    },
    small: {
      subjectCode: '5403',
      subjectName: '税金及附加',
    },
  },
  '004_6_2': {
    gener: {
      subjectCode: '6601',
      subjectName: '销售费用',
    },
    small: {
      subjectCode: '5601',
      subjectName: '销售费用',
    },
  },
  '004_7_2': {
    gener: {
      subjectCode: '6602',
      subjectName: '管理费用',
    },
    small: {
      subjectCode: '5602',
      subjectName: '管理费用',
    },
  },
  '004_8_2': {
    gener: {
      subjectCode: '6603',
      subjectName: '财务费用',
      formula(amt, result, saasData) {
        const value = saasData
          .filter(item => ['6061'].includes(item.subjectCode))
          .reduce((result, item) => {
            result += Number.parseFloat(item.amt || 0);
            return result;
          }, 0);
        return `${Number.parseFloat(amt) + Number.parseFloat(value)}`;
      },
    },
    small: {
      subjectCode: '5603',
      subjectName: '财务费用',
    },
  },
  '004_9_2': {
    gener: {
      subjectCode: '6701',
      subjectName: '资产减值损失',
    },
    small: {},
  },
  '004_10_2': {
    gener: {
      subjectCode: '6101',
      subjectName: '公允价值变动损益',
    },
    small: {},
  },
  '004_11_2': {
    gener: {
      subjectCode: '6111',
      subjectName: '投资收益',
    },
    small: {
      subjectCode: '5111',
      subjectName: '投资收益',
    },
  },
  '004_13_2': {
    gener: {
      subjectCode: '6301',
      subjectName: '营业外收入',
    },
    small: {
      subjectCode: '5301',
      subjectName: '营业外收入',
    },
  },
  '004_14_2': {
    gener: {
      subjectCode: '6711',
      subjectName: '营业外支出',
    },
    small: {
      subjectCode: '5711',
      subjectName: '营业外支出',
    },
  },
};

let hsqjSmall = Object.assign(hsqjSmallInputJson, hsqjCommonJson);

export {
  hsqjSmall,
};
